﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Compiler
{
    public abstract class EbnfNode : INode
    {
        public virtual EbnfNode Expand(Stack<EbnfAssign> Open)
        {
            return this;
        }

        public virtual void Convert2Grammar(Ebnf2GrammarConvertData data)
        {
        }

        public virtual List<Symbol> ConstructProductionTail(Ebnf2GrammarConvertData data)
        {
            return null;
        }
    }

    public class EbnfEpsilonNode : EbnfNode
    {
        public override List<Symbol> ConstructProductionTail(Ebnf2GrammarConvertData data)
        {
            return new List<Symbol> { Symbol.Epsilon };
        }

        public override string ToString()
        {
            return "<EPS>";
        }
    }

    public class EbnfEmptyNode : EbnfNode
    {
        public override string ToString()
        {
            return "EMPTY";
        }
    }
}
